package client;

import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.MessageToByteEncoder;
import backend.core.transport.PackageUtil;

/**
 * 
 */
public class ClientEncoder extends MessageToByteEncoder<String> {
    @Override
    public void encode(ChannelHandlerContext ctx, String msg, ByteBuf out)
            throws Exception {

        String s1 = PackageUtil.genPkgRaw(msg);
        System.out.println("s1 = " + s1);

        out.writeBytes(Unpooled.copiedBuffer(s1.getBytes()));

    }
}